package com.ztmg.water.controller.wxapi.base;

import com.ztmg.common.util.resultUtils.JsonResult;
import com.ztmg.water.service.water.WaterService;
import com.ztmg.water.service.water.WaterTicketService;
import com.ztmg.water.service.wx.WXService;
import com.ztmg.water.vo.water.WaterVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@Api(description = "基础信息接口")
@RequestMapping("api/base")
public class BaseInfoController {
    @Resource
    private WXService wxService;
    @Resource
    private WaterService waterService;
    @Resource
    private WaterTicketService waterTicketService;
    @GetMapping("water")
    @ApiOperation("获取桶装水信息")
    public JsonResult<List<WaterVO>> getWaterInfo(){
        return waterService.listAll(null);
    }

    @GetMapping("ticket")
    @ApiOperation("获取水票信息")
    public JsonResult getTicketInfo(){
        return waterTicketService.listAll(null);
    }

    @PostMapping("getSignString")
    @ApiOperation("获取水票信息")
    public JsonResult getSignString(@RequestBody Map<String,Object> params){
       return wxService.getSign(params.get("content").toString());
    }

}
